package com.newvpn.fastbest.zenith.dialog;

import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.fragment.app.FragmentManager;

import com.newvpn.fastbest.zenith.R;
import com.newvpn.fastbest.zenith.utils.VLog;

import java.util.Random;


public class TestNetReultDialog extends BaseDialog {

    private Button ok;

    public TestNetReultDialog() {

    }

    public static TestNetReultDialog newInstance() {
        return new TestNetReultDialog();
    }


    @Override
    protected int layout() {
        return R.layout.v_dialog_test_net_result;
    }

    @Override
    protected void init(View view) {
        view.findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });
        view.findViewById(R.id.again).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                VLog.event("Retest_Click");
                TestNetDialog dialog = TestNetDialog.newInstance();
                dialog.setCancelable(false);
                FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
                dialog.show(fragmentManager, "");
                dismiss();
            }
        });
        TextView tvReulst = view.findViewById(R.id.tvReulst);
        Random random = new Random();
        int count = 200 + random.nextInt(800);
        tvReulst.setText(String.format(getString(R.string.testing_reuslt),count+""));




    }




}

